package com.zhuiyun.pm.client.bidding.mapper;

import com.zhuiyun.pm.client.bidding.entity.ClientRunningWater;
import com.zhuiyun.pm.config.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClientRunningwaterMapper extends BaseMapper<ClientRunningWater> {

      @Select("select lncome_amount from client_running_water where lncome_amount !=0")
      List<Integer> sum();
      @Select("select expenditure_amount from client_running_water where expenditure_amount!=0 ")
      List<Integer> sumup();


      @Select("select * from client_running_water LIMIT #{page},#{size}")
      @Results({
              @Result(property = "serialNumber",column = "serial_number"),
              @Result(property = "paymentType",column = "payment_type"),
              @Result(property = "makeASummary",column = "make_a_summary"),
              @Result(property = "item",column = "item"),
              @Result(property = "paymentHeader",column = "payment_header"),
              @Result(property = "collectionHeader",column = "collection_header"),
              @Result(property = "lncomeAmount",column = "lncome_amount"),
              @Result(property = "expenditureAmount",column = "expenditure_amount"),
              @Result(property = "createTime",column = "create_time"),
              @Result(property = "updateTime",column = "update_time"),
              @Result(property = "remarks",column = "remarks"),
              @Result(property = "serviceConsultant",column = "service_consultant")
      })
      List<ClientRunningWater> listpage(@Param("page") int page ,@Param("size")int size);




      @Select("select count(id) from client_running_water ")
      Integer total();
      @Insert("insert into client_running_water (payment_type,make_a_summary,item,payment_header,collection_header,lncome_amount," +
              "expenditure_amount,create_time,update_time,remarks,service_consultant) values(#{paymentType}," +
              "#{makeASummary},#{item},#{paymentHeader},#{collectionHeader},#{lncomeAmount},#{expenditureAmount}," +
              "now(),now(),#{remarks},#{serviceConsultant})")
      int add(ClientRunningWater clientRunningWater);
      @Select("select * from client_running_water  ORDER BY  id DESC limit 1 ")
      ClientRunningWater lsbyid();
      @Update("update client_running_water set serial_number = #{serialNumber} where id = #{id}")
      int updateserialNumber(ClientRunningWater clientRunningWater);
}
